package org.test.client.ui;

import java.awt.Container;
import java.awt.Dimension;

import javax.swing.JFrame;

import org.test.client.ui.component.combox.MyComboxModel;
import org.test.client.ui.content.forms.FormsDemo;
import org.test.client.ui.util.UIConstants;
import org.test.client.ui.util.UIUtil;

/**
 * 主Frame
 * 
 * @author Guodeqi
 * @email 305531834@qq.com
 * @since 20150715 
 */
public class MainApplication extends JFrame{
	private MainPanel mainPanel = null;
	
	public static MainApplication mainFrame = null;
	
	public MainApplication(){
		
		doInit();
		
		mainPanel = new MainPanel(this);
		Container contentPane = this.getContentPane();
//		JScrollPane scp = new JScrollPane(mainPanel);
//		scp.setHorizontalScrollBarPolicy(scp.HORIZONTAL_SCROLLBAR_NEVER);
		contentPane.add(mainPanel);
		
		
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		Dimension ss = UIUtil.getScreenSizeWithinInsets(this);
		UIConstants.frameDefaultw = ss.width-UIConstants.screenSpaceHorizon;
		UIConstants.frameDefaulth =ss.height-UIConstants.screenSpaceVertical;
		
		this.setSize(UIConstants.frameDefaultw, UIConstants.frameDefaulth);
		this.setLocationRelativeTo(null);
		this.setMinimumSize(new Dimension(UIConstants.frameMinWidth,UIConstants.frameMinHeight));
		
	}
	
	public void doInit(){
		mainFrame = this;
	}
	
	public static void main(String[] args) {
		UIUtil.initSkin();
		MainApplication mainApplication = new MainApplication();
		mainApplication.setVisible(true);
	}
}

///**
// * 获取当前月的最后一天
// */
//function getCurrentMonthLast(){
// var date=new Date();
// var currentMonth=date.getMonth();
// var nextMonth=++currentMonth;
// var nextMonthFirstDay=new Date(date.getFullYear(),nextMonth,1);
// var oneDay=1000*60*60*24;
// return new Date(nextMonthFirstDay-oneDay);
//}
//var year = 2015;
//var month = 7;
//var day = 1;
//var date=new Date(year,month+1,day);
//var oneDay=1000*60*60*24;
//var lastDayDate = new Date(date-oneDay);
//var lastDay = lastDayDate.getDate();
//var myDate = new Date();
//myDate.getYear();        //获取当前年份(2位)
//myDate.getFullYear();    //获取完整的年份(4位,1970-????)
//myDate.getMonth();       //获取当前月份(0-11,0代表1月)
//myDate.getDate();        //获取当前日(1-31)
//myDate.getDay();         //获取当前星期X(0-6,0代表星期天)
//myDate.getTime();        //获取当前时间(从1970.1.1开始的毫秒数)
//myDate.getHours();       //获取当前小时数(0-23)
//myDate.getMinutes();     //获取当前分钟数(0-59)
//myDate.getSeconds();     //获取当前秒数(0-59)
//myDate.getMilliseconds();    //获取当前毫秒数(0-999)
//myDate.toLocaleDateString();     //获取当前日期
//var mytime=myDate.toLocaleTimeString();     //获取当前时间
//myDate.toLocaleString( );        //获取日期与时间









